The break statement functions similar to the C break. The
break statement provides an early exit from the enclosing for,
or while loop. For example:
> while ( i < 100 ) {
> if(i == 10) { break; }
> i++;
> }
> i
i =
10
//
// OR
//
> i=0;j=0;
> while (i < 5) { while (j < 5) { if (j == 3) { break } j++; } i++; } i j
i =
5
j =
3
if tests do not accept matrices. The any()
and
all()
functions can be used in combination with relational
and logical tests to conditionally execute statements based upon
matrix properties.
The function any()
(See page
returns 1 if
any of the elements of its argument are non-zero. The function
all()
(See page
returns 1
if all of the elements of it's argument are non-zero. The any()
function is often called on the result of another any()
call
because the any()
function returns a vector when passed
a matrix that is not already a vector.